/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package net.icom.maf.ui.component;

import javax.microedition.lcdui.Graphics;

/**
 *
 * @author Darren.Beukes
 */
public abstract class Component {
    
    private int x;
    
    private int y;
    
    private int width;
    
    private int height;
    
    private boolean visible;
    
    /**
     * Returns the height for this component
     * @return integer representing the height of this component 
     */
    public int getHeight() {
        return height;
    }
    
    /**
     * Determines whether or not this component is visble
     * @return boolen indicating component visibility
     */
    public boolean isVisible() {
        return visible;
    }

    /**
     * Returns the width for this component
     * @return integer representing the width of this component
     */
    public int getWidth() {
        return width;
    }

    /**
     * Returns the x position of this component, relative to the parent container
     * @return integer representing the x position of this component.
     */
    public int getX() {
        return x;
    }
    
    /**
     * Returns the y position of this component, relative to the parent container.
     * @return integer representing the y position fo this component.
     */
    public int getY() {
        return y;
    }

    /**
     * Sets the height of this component.  Note that components using image backgrounds will attempt to automatically determine their height and width unless the method is called explicitly
     * @param height integer argument to set the height of this component
     */
    public void setHeight(int height) {
        this.height = height;
    }

    /**
     * Set the visibility flag of this component.
     * @param visible boolean, true sets the controller to visible, false hides it from view.
     */
    public void setVisible(boolean visible) {
        this.visible = visible;
    }
    
    /**
     * Set the width of this component.  NOt that components using image backgrounds will attemp to automatically determine their height and width unless this method is caleld explicitly.
     * @param width integer argument to set the width of this component
     */
    public void setWidth(int width) {
        this.width = width;
    }
    
    /**
     * Set the x position of this component relative to the parent container
     * @param x integer argument to set the x position of this component relative to the parent container.
     */
    public void setX(int x) {
        this.x = x;
    }

    /**
     * Set the y position of this component relative to the parent container
     * @param y integer argument to set the y position of this component relative to the parent container
     */
    public void setY(int y) {
        this.y = y;
    }
    
    /**
     * Override this method to define how this component should be drawn
     * @param g javax.microedition.lcdui.Graphics passed down from the calling paint method.
     */
    public abstract void paint(Graphics g);
    
}
